import moment from 'moment'

let filters = {
    // 格式化日期
    filterStatus : status => {
        let txt = '';
        console.log(txt, status)
        if(status === 'Prepare'){
            txt = '预制'
        } else if(status === 'IN'){
            txt = '入库'
        } else if(status === 'OUT'){
            txt = '出库'
        } else if(status === 'USEING'){
            txt = '正在使用'
        } else if(status === 'FORBIDDEN'){
            txt = '禁用'
        }else if(status === 'FAULT'){
            txt = '故障'
        }
        return txt;
    },
    filterDate: creatTime => {
      let time = moment(creatTime).format('YYYY-MM-DD')
      return time;
    },
    filterActive(active) {
      let txt = '';
      if(active === 'OFF'){
          txt = '离线'
      } else if(active === 'ON'){
          txt = '在线'
      }
      return txt;
    }
}

export default filters
